@echo off
color 0A

:: 指定起始文件夹
@REM set "DIR=C:\vscode_code\Personal\mcucheck-lib\C_EncryptionAlgorithms"

:: 使用当前路径作为起始文件夹
set "DIR=%CD%"
set "AS=C:\app\AStyle\bin\AStyle.exe"

:: 定义 AStyle 的命令行选项
set "ASTYLE_OPTIONS=--suffix=none --style=kr -i --convert-tabs --indent=force-tab=4 --max-code-length=100 --pad-oper --pad-header --align-pointer=type "

echo DIR=%DIR%
echo AStyle options: %ASTYLE_OPTIONS%

:: 格式化 *.c *cpp *.h 文件
for /R "%DIR%" %%f in (*.c *.cpp *.h) do (
    echo Formatting file: "%%f"
    "%AS%" %ASTYLE_OPTIONS% "%%f"
)

pause